<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>type primary</title>
</head>
<script>
  window.onload = function () {
    /**
     *  基本数据类型
     */
      // string 类型
    var name = "codergege"
    console.log(name)
    console.log(typeof(name)) // string
    // number 类型
    var age = 18
    console.log(age)
    console.log(typeof age) //
    // boolean
    var isMale = true
    var isFemail = false
    console.log(isMale)
    console.log(typeof isMale) // boolean
    // null
    var pet = null
    console.log(pet) // null
    console.log(typeof pet) // object; null 也是一种对象
    // 检查是否是 null
    if(pet === null && typeof pet === "object") {
      console.log("pet is null")
    }
    // 或更简洁一点, 只会对 null 值通过检测;
    // 对 '', undefined, false, 0, NaN 都不会检测通过
    if(pet === null) {
      console.log("pet is null")
    }

    // undefined
    var job
    console.log(job) // undefined
    console.log(typeof job) // undefined
  }
</script>
<body>

</body>
</html>